#include<iostream>
#include<vector>
using namespace std;
class Solution
{
public:
    void sortColors(vector<int>& nums)
    {
        int right = nums.size() - 1;
        for (int i = 0, left = 0; i <= nums.size() - 1; i++)
        {
            if (nums[i] == 0)
            {
                swap(nums[i++], nums[++left]);
            }
            if (nums[i] == 1)
            {
                i++;
            }
            if (nums[i] == 2)
            {
                swap(nums[i], nums[--right]);
            }
        }

    }
};
int main()
{
    Solution s;
    vector<int> v = { 2,0,2,1,1,0 };
    s.sortColors(v);
    return 0;
}